﻿using UnityEngine;
using System.Collections;

public class ButtonsManager : MonoBehaviour 
{
	#region LOADING SCREEN
	#endregion
	
	#region PAUSE SCREEN
	void Pause ()
	{
		StateManager.Instance.CallPauseScreen();
	}

	void PauseSound ()
	{
	}

	void PauseMusic ()
	{
	}

	void PauseContinue ()
	{
		StateManager.Instance.CallPauseScreen();
	}

	void PauseMainMenu ()
	{
		StateManager.Instance.CallPauseScreen();
		StateManager.Instance.CallLoadingScreen(StateManager.GAME_STATES.MAIN_MENU);
	}
	#endregion

	#region MAIN MENU
	void MainMenuContinue ()
	{
		if ( StateManager.Instance.currentState != StateManager.GAME_STATES.MAIN_MENU )
			return;

		StateManager.Instance.CallLoadingScreen(StateManager.GAME_STATES.INGAME);
	}

	void MainMenuNewGame ()
	{
		if ( StateManager.Instance.currentState != StateManager.GAME_STATES.MAIN_MENU )
			return;

		StateManager.Instance.CallLoadingScreen(StateManager.GAME_STATES.STORYBOARD);
	}

	void MainMenuCredits ()
	{
		if ( StateManager.Instance.currentState != StateManager.GAME_STATES.MAIN_MENU )
			return;

		StateManager.Instance.CallCreditsScreen();
	}

	void MainMenuMoreGames ()
	{
		if ( StateManager.Instance.currentState != StateManager.GAME_STATES.MAIN_MENU )
			return;

		Application.OpenURL("http://www.freegamesforyourwebsite.com/");
	}
	#endregion

	#region CREDITS SCREEN
	void CreditsContinue ()
	{
		StateManager.Instance.CallCreditsScreen();
	}
	#endregion


	#region STORYBOARD
	void StoryboardContinue ()
	{
		if ( StateManager.Instance.currentState != StateManager.GAME_STATES.STORYBOARD )
			return;

//		StateManager.Instance.CallLoadingScreen(StateManager.GAME_STATES.INGAME);
	}
	#endregion

	#region INGAME
	#endregion
	
	#region GAME OVER
	void GameOverAchievements ()
	{
		if ( StateManager.Instance.currentState != StateManager.GAME_STATES.GAME_OVER )
			return;
	
		StateManager.Instance.CallLoadingScreen(StateManager.GAME_STATES.ACHIEVEMENTS);
	}

	void GameOverRetry ()
	{
		if ( StateManager.Instance.currentState != StateManager.GAME_STATES.GAME_OVER )
			return;

		StateManager.Instance.CallLoadingScreen(StateManager.GAME_STATES.INGAME);
	}

	void GameOverShop ()
	{
		if ( StateManager.Instance.currentState != StateManager.GAME_STATES.GAME_OVER )
			return;

		StateManager.Instance.CallLoadingScreen(StateManager.GAME_STATES.SHOP);
	}
	#endregion
	
	#region ACHIEVEMENTS
	void AchievementsBack ()
	{
		if ( StateManager.Instance.currentState != StateManager.GAME_STATES.ACHIEVEMENTS )
			return;

		StateManager.Instance.CallLoadingScreen(StateManager.GAME_STATES.GAME_OVER);
	}
	#endregion
	
	#region SHOP
	void ShopRetry ()
	{
		if ( StateManager.Instance.currentState != StateManager.GAME_STATES.SHOP )
			return;

		StateManager.Instance.CallLoadingScreen(StateManager.GAME_STATES.INGAME);
	}
	#endregion
}
